import java.awt.*;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: Java.test
 * User: 王圆豪
 * Date: 2024-04-21
 * Time: 18:52
 */

//定义dog类型：

class Dog {
    public String name;
    public int age;

    public void set(String n, int a) {
        this.name = n;
        this.age = a;
    }

    public void pr() {
        System.out.println(this.name + "   " + this.age);
    }
}


class Test {
    public static void hello() {
        System.out.println("hello");
    }
}
public class Main {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Test test=null;
        test.hello();
    }
//    public static void main(String[] args){
//
//        String s;
//
//        System.out.println("s="+s);
//
//    }
    public static void main30(String[] args) {
        Dog dog = new Dog();
        dog.set("小黑", 1);
        dog.pr();
    }
    public static void main29(String[] args) {
        int a = 9;
        int b = 6;
        while (b != 0) {
            int c = b;
            b = a % b;
            a = c;
        }
        System.out.println(a);
    }
    //7-2 sdut-分数加减法
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        while (sc.hasNextInt()) {
//            int a = sc.nextInt();
//            char m = sc.next().charAt(0);
//            int b = sc.nextInt();
//            char o = sc.next().charAt(1);
//            int c = sc.nextInt();
//            m = sc.next().charAt(2);
//            int d = sc.nextInt();
//            if (o == '+') {
//
//            } else if (o == '-') {
//
//            }
//        }
//    }
    //游泳池过道改造
    public static void main28(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double s1 = Math.PI * n * n;
        double s2 = Math.PI * (n + 3) * (n + 3);
        double s3 = s2 - s1;
        double c = 2 * Math.PI * (n+3);
        double price = 35 * c;
        double price2 = 20 * s3;
        System.out.printf("Fencing Cost is $%.2f\n", price);
        System.out.printf("Concrete Cost is $%.2f", price2);
    }
    //存在连续三个奇数的数组
    public static boolean odd(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if (count ==3) {
                return true;
            }
            if (array[i] % 2 != 0){
                count++;
            } else {
                count = 0;
            }
        }
        return false;
    }
    public static void main27(String[] args) {
        int[] array = new int[]{1,2,34,3,4,5,7,23,12};
        boolean a = odd(array);
        System.out.println(a);
    }
    //多数元素
    public static int maj(int[] array) {
        if (array[0] == array[array.length / 2 + 1]) {
            return array[0];
        } else if (array[array.length / 2] == array[array.length - 1]) {
            return array[array.length - 1];
        }
        return -1;
    }
    public static void main26(String[] args) {
        int[] array = new int[]{2, 2, 1, 1, 1, 2, 2};
//        for (int i = 0; i < array.length - 1; i++) {
//            for (int j = 0; j < array.length - 1 - i; j++) {
//                if (array[j] > array[j + 1]) {
//                    int y = array[j];
//                    array[j] = array[j + 1];
//                    array[j + 1] = y;
//                }
//            }
//        }
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
        int tmp = maj(array);
        System.out.println(tmp);
    }
    //只出现一次的数字
    public static int sole(int[] array) {
        int n = array[0];
        for (int i = 1; i < array.length; i++) {
            n ^= array[i];
        }
        return n;
    }
    public static void main25(String[] args) {
        int[] array = new int[]{4, 1, 2, 1, 2};
        int tmp = sole(array);
        System.out.println(tmp);
    }
    //两数之和
    public static int[] mem(int[] array, int sum) {
        int[] ret = new int[2];
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = i; j < array.length - 1; j++) {
                if (i == j) {
                    continue;
                }
                else {
                    if (array[i] + array[j] == sum) {
                        ret[0] = i;
                        ret[1] = j;
                    }
                }
            }
        }
        return ret;
    }
    public static void main24(String[] args) {
        int[] array = new int[]{2, 7, 11, 15};
        int[] tmp = mem(array, 9);
        System.out.println(Arrays.toString(tmp));
    }
    //冒泡排序
    public static void buSort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = 0; j < array.length - 1 - i; j++) {
                if (array[j] > array[j + 1]) {
                    int t = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = t;
                }
            }
        }
    }
    public static void main23(String[] args) {
        int[] array = new int[]{3, 2, 5, 6, 1};
        buSort(array);
        System.out.println(Arrays.toString(array));
    }
    //二分查找
    public static int bSearch(int[] array, int pos) {
        int right = array.length - 1;
        int left = 0;
        while (left <= right) {
            int mid = (right + left) / 2;
            if (pos < array[mid]) {
                right = mid - 1;
            } else if (pos > array[mid]) {
                left = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
    public static void main22(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5, 6};
        int t = bSearch(array, 3);
        System.out.println(t);
    }
    //奇数位于偶数之前
    public static void lineArray(int[] array) {
        int front = 0;
        int behind = array.length - 1;
        while (front <= behind) {
            if (array[front] % 2 != 0 || array[behind] % 2 == 0) {
                if (array[front] % 2 != 0){
                    front++;
                }
                if (array[behind] % 2 == 0) {
                    behind--;
                }
            }
            else {
                int tmp = array[front];
                array[front] = array[behind];
                array[behind] = tmp;
            }
        }
    }
    public static void main21(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5, 6};
        lineArray(array);
        System.out.println(Arrays.toString(array));
    }
    //改变原有数组元素的值
    public static int[] multwo(int[] array) {
        int[] ret = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            ret[i] = array[i] * 2;
        }
        return ret;
    }
    public static void main20(String[] args) {
        int[] array = new int[]{1,2,3};
        int[] tmp = multwo(array);
        System.out.println(Arrays.toString(tmp));
    }
    //实现 String myToString函数
    public static void mytostring(int[] array) {
        System.out.print("[" + array[0] + ',');
        for (int i = 1; i < array.length - 1; i++) {
            System.out.print(array[i] + ",");
        }
        System.out.print(array[array.length - 1] + "]");
    }
    public static void main19(String[] args) {
        int[] array = new int[]{1,2,3,4};
        mytostring(array);
    }
    //龟兔赛跑
    public static void main18(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        int w = 0;
        int r = 0;
        int j = 0;
        for (int i = 0; i < t; i++) {
            w += 3;
            if (i % 10 == 0 && j == 0 && r > w) {
                j = 30;
            }

            if (j == 0) {
                r += 9;
            }
            else {
                j--;
            }
        }
        if (w > r) {
            System.out.println("@_@ " + w);
        } else if (w == r) {
            System.out.println("-_-");
        } else {
            System.out.println("^_^ " + r);
        }
    }
    //求特殊方程的正整数解
    public static void main17(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        for (int x = 1; x < 100; x++) {
            for (int y = x; y < 100; y++) {
                int a = x * x;
                int b = y * y;
                if (a + b == n){
                    count = 1;
                    System.out.println(x + " " + y);
                }
            }
        }
        if (count == 0){
            System.out.println("No Solution");
        }
    }
    //7-20 打印九九口诀表
    public static void main16(String[] args) {
        int n = 0;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.printf("%d*%d=%-4d", j, i, j*i);
            }
            System.out.println();
        }
    }
    //支票面额
    public static void main15(String[] args) {
        int count = 0;//记录是否有解
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int y = 0; y<100; y++){
            for (int f = 0; f < 100; f++) {
                int money = f * 100 + y;
                int money1 = 200 * y + f * 2;
                if (money - n == money1){
                    count = 1;
                    System.out.printf("%d.%d", y, f);
                    break;
                }
            }
            if (count == 1){
                break;
            }
        }
        if(count == 0){
            System.out.println("No Solution");
        }
    }
    //递归求解汉诺塔问题
    public static void hnt(int n, char a, char b, char c) {
        if (n == 1){
            System.out.print(a + "->" + c + "  ");
        }
        else {
            hnt(n - 1, a, c, b);
            System.out.print(a + "->" + c + "  ");
            hnt(n - 1, b, a, c);
        }
    }
    public static void main14(String[] args) {
        hnt(1, 'A', 'B', 'C');
        System.out.println();
        hnt(2, 'A', 'B', 'C');
        System.out.println();
        hnt(3, 'A', 'B', 'C');
    }
    //求最大值方法的重载
    public static int max(int a, int b) {
        return a > b ? a : b;
    }
    public static double max(double a, double b, double c) {
        double max1 = a>b?a:b;
        double max2 = a>c?a:c;
        return max1>max2?max1:max2;
    }
    public static void main13(String[] args) {
        System.out.println(max(1,2));
        System.out.println(max(1.3, 2.3, 1.4));
    }
    //求和的重载
    public static int add(int a, int b) {
        return a + b;
    }
    public static double add(double a, double b, double c) {
        return a + b + c;
    }
    public static void main12(String[] args) {
        System.out.println(add(3, 4));
        System.out.println(add(1.0, 2.9, 4.2));
    }
    //使用函数求最大值
    public static int max2(int a, int b) {
        return (a > b ? a : b);
    }
    public static int max3(int a, int b, int c) {
        return (max2(a,b) > max2(b,c) ? max2(a,b) : max2(b,c));
    }
    public static void main11(String[] args) {
        System.out.println(max2(1,2));
        System.out.println(max3(5,4,3));
    }
    //递归求组成它的数字之和
    public static int memberAdd(int n) {
        if (n < 10){
            return n;
        }
        else {
            return n % 10 + memberAdd(n/10);
        }
    }
    public static void main10(String[] args) {
        System.out.println(memberAdd(1729));
    }
    //递归求1+2+3+....+10
    public static int sum(int n) {
        if (n == 1){
            return 1;
        }
        else {
            return n + sum(n - 1);
        }
    }
    public static void main9(String[] args) {
        System.out.println(sum(10));
    }
    public static void main8(String[] args) {//二进制1的个数
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int num = 0;
        while (n != 0){
            if ((n & 0x1) == 1){
                num++;
            }
            n >>= 1;
        }
        System.out.println(num);
    }
    public static void main7(String[] args) {//求2个整数的最大公约数
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = 1;
        for (int i = 2; i < b; i++) {
            if (a % i == 0 && b % i == 0){
                c = i;
            }
        }
        System.out.println(c);
    }
    public static void main6(String[] args) {//计算分数的值
        double add = 1;
        int a = -1;
        for (double i = 2; i <= 100; i++) {
            double b = a / i;
            add += b;
            a *= -1;
        }
        System.out.println(add);
    }
    public static void main5(String[] args) {//水仙花数
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n > 999 || n<100){
            System.out.println(n + "不是水仙花数");
        }
        else{
            int add = 0;
            int n1 = n;
            while (n1 != 0){
                int k = n1%10;
                add += (k*k*k);
                n1 /= 10;
            }
            if (add != n){
                System.out.println(n + "不是水仙花数");
            }else {
                System.out.println(n + "是水仙花数");
            }
        }
    }
    public static void main4(String[] args) {//打印 X 图形
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i == j || i + j == n - 1) {
                        System.out.print("*");
                    } else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
        public static void main3(String[] args) {//判定素数
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = 0;
        for (int i = 2; i < a; i++) {
            if (a % i == 0){
                System.out.println(a + "不是素数");
                b = 1;
                break;
            }
        }
        if (b == 0){
            System.out.println(a + "是素数");
        }
    }
    public static void main2(String[] args) {//数字9 出现的次数
        int a = 0;
        for (int i = 1; i <= 100; i++) {
            int n = i;
            while (n != 0){
                if (n % 10 == 9){
                    a++;
                }
                n/=10;
            }
        }
        System.out.println(a);
    }
    public static void main1(String[] args) {//打印“Hello world”
        System.out.println("Hello world");
        float a = 1.5f;
    }
}
